package cn.xd.core.utils;

import cn.xd.core.ddd.value.basic.Value;

import java.io.Serializable;

/**
 * @author mirzaLin
 * @data 2023/11/17
 * @description
 **/
public class ValueUtils {
    public static boolean isNull(Value value) {
        if (value != null && value.getValue() != null) {
            return false;
        }
        return true;
    }

    public static boolean isNotNull(Value value) {
        return !isNull(value);
    }

    public static <T extends Serializable> T get(Value<T> value) {
        if (isNull(value)) {
            return null;
        }
        return value.getValue();
    }
}
